package Models;

public class Ingredient {
	public static final String DEFAULT_ADDITION_METHOD = "Standard";
	public static final String MALT = "Malt";
	public static final String HOPS = "Hops";
	public static final String YEAST = "Yeast";
	public static final String ADJUNCT = "Adjunct";
	public static final String PELLLET = "Pellet";
	public static final String LEAF = "Leaf";
	public static final String PLUG = "Plug";
	public static final String EXTRACT = "Extract";
	
	
	private String ingredientName;
	private String ingredientType;
	private String description;

	
	public Ingredient() {
		
	}
	
	/**
	 * copy constructor
	 * @param old
	 */
	public Ingredient(Ingredient old) {
		this.ingredientName = old.ingredientName;
		this.ingredientType = old.ingredientType;
		this.description = old.description;
	}

	/**
	 * @return the ingredientName
	 */
	public String getIngredientName() {
		return ingredientName;
	}

	/**
	 * @return the ingredientType
	 */
	public String getIngredientType() {
		return ingredientType;
	}


	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param ingredientName the ingredientName to set
	 */
	public void setIngredientName(String ingredientName) {
		this.ingredientName = ingredientName;
	}

	/**
	 * @param ingredientType the ingredientType to set
	 */
	public void setIngredientType(String ingredientType) {
		this.ingredientType = ingredientType;
	}


	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	
	@Override
	public boolean equals(Object comparison) {
		/*
		 * null values
		 * ppg, description, 
		 */
		boolean toReturn = true;
		Ingredient comp = (Ingredient) comparison;
		
		
		
		if(this.description == null) {
			if(comp.description != null)
				toReturn = true;
		} else if (!this.description.equals(comp.description))
			toReturn = false;
		
			
		if(toReturn == true && !this.ingredientName.equals(comp.ingredientName)&&
				!this.ingredientType.equals(comp.ingredientType))
			toReturn = false;
		
		return toReturn;
	}
	
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("Ingredient: ");
		sb.append(ingredientName);
		sb.append("||");
		sb.append(ingredientType);

		
		return sb.toString();
	}
}
